package doru;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;


public class LoadConfig {
	
	//Names for files to be uploaded
	static String blocked;
	static String sessionUrl = "url.session";
	static String sessionIP = "ip.session";
	static String blockListFile = "blocklist.txt";
		String urlBase = null;
		String IPBase = null;
		String blockList = null;
	
		public LoadConfig(){
		 
		
		//find out if file exists
		boolean urlExists = (new File(sessionUrl)).exists();
		boolean IPExists = (new File(sessionIP)).exists();
		boolean blockListFileExists = (new File(blockListFile)).exists();
		
		//if file exists change the base text used to create session files
		if(urlExists){
			urlBase = loadFile(sessionUrl);
		
		}else{
			urlBase = "{\"windows\":[{\"tabs\":[{\"entries\":[{\"url\":\"http://www.robtex.com/dns/FILLMEIN.html#shared\",\"title\":\"FILLMEIN\",\"ID\":1535290687,\"formdata\":{\"//xhtml:form[@id='f']/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td/xhtml:input[@name='q']\":\"FILLMEIN\",\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk2']\":true,\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk3']\":true,\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk4']\":true,\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk5']\":true},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318935631-1\",\"lastViewedKey\":\"1294320446847\",\"lastLoadedKey\":\"1294320448839\",\"uriKey\":\"robtex.com.www/http//dns/FILLMEIN.html#shared\",\"read\":\"true\",\"uriGroup\":\":dG-robtex:\",\"image\":\"http://www.robtex.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://senderbase.org/senderbase_queries/detaildomain?search_string=FILLMEIN\",\"title\":\"SenderBase® - FILLMEIN\",\"ID\":1535291181,\"formdata\":{\"#detailquery\":\"\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318945689-2\",\"lastViewedKey\":\"1294319183484\",\"lastLoadedKey\":\"1294320455741\",\"uriKey\":\"senderbase.org/http//senderbase_queries/detaildomain?search_string=FILLMEIN\",\"possibleparent\":\"1294318935631-1\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-senderbase:\",\"image\":\"http://senderbase.org/static/images/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://amada.abuse.ch/?search=FILLMEIN\",\"title\":\"Malware Database (AMaDa) by abuse.ch\",\"ID\":1535291564,\"formdata\":{\"#search\":\"\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318945891-3\",\"lastViewedKey\":\"1294319172581\",\"lastLoadedKey\":\"1294320450712\",\"uriKey\":\"abuse.ch.amada/http//?search=FILLMEIN\",\"possibleparent\":\"1294318945689-2\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-abuse:\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://google.com/safebrowsing/diagnostic?site=FILLMEIN\",\"title\":\"Google Safe Browsing diagnostic page for FILLMEIN\",\"ID\":1535292210,\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318946083-4\",\"lastViewedKey\":\"1294319158719\",\"lastLoadedKey\":\"1294320450912\",\"uriKey\":\"google.com/http//safebrowsing/diagnostic?site=FILLMEIN\",\"possibleparent\":\"1294318945891-3\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-google:\",\"image\":\"http://google.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://hosts-file.net/?s=FILLMEIN\",\"title\":\"hpHosts Online - Simple, Searchable & FREE!\",\"ID\":1535292886,\"formdata\":{\"/xhtml:html/xhtml:body/xhtml:table[2]/xhtml:tbody/xhtml:tr/xhtml:td/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[2]/xhtml:form/xhtml:input[@name='s']\":\"\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318946308-5\",\"lastViewedKey\":\"1294319139794\",\"lastLoadedKey\":\"1294320449750\",\"uriKey\":\"hosts-file.net/http//?s=FILLMEIN\",\"possibleparent\":\"1294318946083-4\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-hosts-file:\",\"image\":\"http://hosts-file.net/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.malwaredomainlist.com/mdl.php?search=FILLMEIN\",\"title\":\"Malware Domain List\",\"ID\":1535293032,\"formdata\":{\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[2]/xhtml:input[@name='search']\":\"\",\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[3]/xhtml:select[@name='colsearch']\":0,\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[5]/xhtml:select[@name='quantity']\":0,\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[6]/xhtml:input[@name='inactive']\":false},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318946500-6\",\"lastViewedKey\":\"1294319125580\",\"lastLoadedKey\":\"1294320451092\",\"uriKey\":\"malwaredomainlist.com.www/http//mdl.php?search=FILLMEIN\",\"possibleparent\":\"1294318946308-5\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-malwaredomainlist:\",\"image\":\"http://www.malwaredomainlist.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.mcafee.com/threat-intelligence/domain/default.aspx?domain=FILLMEIN\",\"title\":\"FILLMEIN - Domain - McAfee Labs Threat Center\",\"ID\":1535293262,\"formdata\":{\"#q\":\"Search\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318946707-7\",\"lastViewedKey\":\"1294319103323\",\"lastLoadedKey\":\"1294320460126\",\"uriKey\":\"mcafee.com.www/http//threat-intelligence/domain/default.aspx?domain=FILLMEIN\",\"possibleparent\":\"1294318946500-6\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-mcafee:\",\"image\":\"http://www.mcafee.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.mywot.com/en/scorecard/FILLMEIN\",\"title\":\"FILLMEIN | WOT Reputation Scorecard | WOT (Web of Trust)\",\"ID\":1535293817,\"formdata\":{\"#help_c\":false,\"#conf43\":\"\",\"#edit-url2\":\"example.com\",\"#conf9771\":\"\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318946931-8\",\"lastViewedKey\":\"1294319085952\",\"lastLoadedKey\":\"1294320458490\",\"uriKey\":\"mywot.com.www/http//en/scorecard/FILLMEIN\",\"possibleparent\":\"1294318946707-7\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-mywot:\",\"image\":\"http://cdn-aws.mywot.net/sites/all/images/fusion/16_16/plain/new_trusted.png\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://safeweb.norton.com/report/show?url=FILLMEIN\",\"title\":\"Norton Safe Web, from Symantec - report for FILLMEIN\",\"ID\":1535294452,\"formdata\":{\"#domain\":\"enter site address\",\"#safe-search-text\":\"Norton Safe Search\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318947139-9\",\"lastViewedKey\":\"1294319076322\",\"lastLoadedKey\":\"1294320460027\",\"uriKey\":\"norton.com.safeweb/http//report/show?url=FILLMEIN\",\"possibleparent\":\"1294318946931-8\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-norton:\",\"image\":\"http://safeweb.norton.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"https://zeustracker.abuse.ch/monitor.php?host=FILLMEIN\",\"title\":\"ZeuS Tracker :: ZeuS Host FILLMEIN\",\"ID\":1535295137,\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294318947383-10\",\"lastViewedKey\":\"1294318947405\",\"lastLoadedKey\":\"1294320456317\",\"uriKey\":\"abuse.ch.zeustracker/https//monitor.php?host=FILLMEIN\",\"possibleparent\":\"1294318947139-9\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-abuse:\",\"image\":\"https://zeustracker.abuse.ch/favicon.ico\"},\"_formDataSaved\":true}],\"selected\":1,\"_closedTabs\":[],\"extData\":{\"__SessionManagerWindowId\":\"window1294320445805\",\"autoGroupNewTabs\":\"true\",\"activeGrouping\":\"opener\",\"newTabPosition\":\"0\"},\"_hosts\":{\"www.robtex.com\":true,\"senderbase.org\":true,\"amada.abuse.ch\":true,\"google.com\":true,\"hosts-file.net\":true,\"www.malwaredomainlist.com\":true,\"www.mcafee.com\":true,\"www.mywot.com\":true,\"safeweb.norton.com\":true},\"width\":1467,\"height\":1097,\"screenX\":353,\"screenY\":43,\"sizemode\":\"normal\",\"cookies\":[{\"host\":\"senderbase.org\",\"value\":\"9FE3Hcr6NIEDL0tMmZ8U\",\"path\":\"/\",\"name\":\"sid\"},{\"host\":\"hosts-file.net\",\"value\":\"ALILONDCEOBFIPPMNJLCFMHJ\",\"path\":\"/\",\"name\":\"ASPSESSIONIDCSATQABA\"},{\"host\":\"www.mcafee.com\",\"value\":\"locale=us\",\"path\":\"/\",\"name\":\"CookieInformation\"},{\"host\":\".mcafee.com\",\"value\":\"%5B%5BB%5D%5D\",\"path\":\"/\",\"name\":\"s_sq\"},{\"host\":\".mcafee.com\",\"value\":\"true\",\"path\":\"/\",\"name\":\"s_cc\"},{\"host\":\".mywot.com\",\"value\":\"ee8040199ab2604654ff924a4d43a153e6685036\",\"path\":\"/\",\"name\":\"auth\",\"expiry\":1294320532339},{\"host\":\".mywot.com\",\"value\":\"a27ca6cd9a3a12e56b5486dd9cff55da1e681256\",\"path\":\"/\",\"name\":\"nonce\",\"expiry\":1294320532338},{\"host\":\".mywot.com\",\"value\":\"1988b3acf515f0999e81796af551556cde9fc601\",\"path\":\"/\",\"name\":\"id\",\"expiry\":1294320532338},{\"host\":\".mywot.com\",\"value\":\"\",\"path\":\"/\",\"name\":\"partner\",\"expiry\":1294320532337},{\"host\":\".mywot.com\",\"value\":\"false\",\"path\":\"/\",\"name\":\"accessible\",\"expiry\":1294320532336},{\"host\":\".mywot.com\",\"value\":\"lfbdgqcbrcpi0ph3dkd1tjo4u5\",\"path\":\"/\",\"name\":\"SESSf6ce7e3db235723091e59a653e7d96f2\"},{\"host\":\".mywot.com\",\"value\":\"1988b3acf515f0999e81796af551556cde9fc601\",\"path\":\"/\",\"name\":\"authid\"},{\"host\":\"safeweb.norton.com\",\"value\":\"BAh7CToSZXNsX3NlbGVjdGlvbiIKZmFsc2U6D3Zpc2l0b3JfaWQiJTkzMTc0%0AOGFjOThhMjgyYjY4ZjIxZGY1MzFkYzliZmI4Ogxjc3JmX2lkIiU0M2I0YTU2%0ANGJhMzZiODQzOGQ3NWM0ZWMyOTdlMDY0MSIKZmxhc2hJQzonQWN0aW9uQ29u%0AdHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--f493f117680955b951bc13e92c474fa1e5faa68a\",\"path\":\"/\",\"name\":\"_shasta_website_session\"}]}]}\r\n";
		}
			
		//if file exists change the base text used to create session files
		if(IPExists){
			IPBase = loadFile(sessionIP);
			
		}else{
			//IPBase = "{\"windows\":[{\"tabs\":[{\"entries\":[{\"url\":\"http://www.robtex.com/ip/FILLMEIN.html#shared\",\"title\":\"FILLMEIN\",\"ID\":1535020304,\"formdata\":{\"//xhtml:form[@id='f']/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td/xhtml:input[@name='q']\":\"FILLMEIN\",\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk2']\":true,\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk3']\":true,\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk4']\":true,\"//xhtml:div[@id='boxes']/xhtml:input[@name='chk5']\":true},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319549516-1\",\"lastViewedKey\":\"1294320364877\",\"lastLoadedKey\":\"1294320177796\",\"uriKey\":\"robtex.com.www/http//ip/FILLMEIN.html#shared\",\"read\":\"true\",\"uriGroup\":\":dG-robtex:\",\"image\":\"http://www.robtex.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://senderbase.org/senderbase_queries/detailip?search_string=FILLMEIN\",\"title\":\"SenderBase® - FILLMEIN\",\"ID\":1535020539,\"formdata\":{\"#detailquery\":\"\",\"#which_others\":0},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319578580-2\",\"lastViewedKey\":\"1294320348560\",\"lastLoadedKey\":\"1294320198932\",\"uriKey\":\"senderbase.org/http//senderbase_queries/detailip?search_string=FILLMEIN\",\"possibleparent\":\"1294319549516-1\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-senderbase:\",\"image\":\"http://senderbase.org/static/images/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://blacklistalert.org/\",\"title\":\"BLACKLISTALERT.ORG - Test if your IP or DOMAIN is listed in a spamdatabase\",\"ID\":1535021077},{\"url\":\"http://blacklistalert.org/\",\"title\":\"BLACKLISTALERT.ORG - Test if your IP or DOMAIN is listed in a spamdatabase\",\"cacheKey\":1294320148,\"ID\":21,\"referrer\":\"http://blacklistalert.org/\",\"formdata\":{\"/xhtml:html/xhtml:body/xhtml:center/xhtml:form/xhtml:font/xhtml:input[@name='q']\":\"FILLMEIN\"},\"scroll\":\"0,0\"}],\"index\":2,\"attributes\":{\"tabid\":\"1294319578863-3\",\"lastViewedKey\":\"1294320345392\",\"lastLoadedKey\":\"1294320255600\",\"uriKey\":\"blacklistalert.org/http//\",\"possibleparent\":\"1294319578580-2\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-blacklistalert:\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.dnsbl.info/dnsbl-database-check.php?IP=FILLMEIN\",\"title\":\"DNSBL Information - Spam Database Lookup\",\"ID\":1535021482,\"formdata\":{\"//xhtml:div[@id='quickcheck']/xhtml:input[@name='IP']\":\"216.81.80.134\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319579166-4\",\"lastViewedKey\":\"1294320341325\",\"lastLoadedKey\":\"1294320231536\",\"uriKey\":\"dnsbl.info.www/http//dnsbl-database-check.php?IP=FILLMEIN\",\"possibleparent\":\"1294319578863-3\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-dnsbl:\",\"image\":\"http://www.dnsbl.info/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://hosts-file.net/?s=FILLMEIN\",\"title\":\"hpHosts Online - Simple, Searchable & FREE!\",\"ID\":1535021836,\"formdata\":{\"/xhtml:html/xhtml:body/xhtml:table[2]/xhtml:tbody/xhtml:tr/xhtml:td/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[2]/xhtml:form/xhtml:input[@name='s']\":\"\"},\"scroll\":\"0,342\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319579535-5\",\"lastViewedKey\":\"1294320331714\",\"lastLoadedKey\":\"1294320191698\",\"uriKey\":\"hosts-file.net/http//?s=FILLMEIN\",\"possibleparent\":\"1294319579166-4\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-hosts-file:\",\"image\":\"http://hosts-file.net/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.malwaredomainlist.com/mdl.php?search=FILLMEIN\",\"title\":\"Malware Domain List\",\"ID\":1535022043,\"formdata\":{\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[2]/xhtml:input[@name='search']\":\"\",\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[3]/xhtml:select[@name='colsearch']\":0,\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[5]/xhtml:select[@name='quantity']\":0,\"/xhtml:html/xhtml:body/xhtml:div/xhtml:div[3]/xhtml:center/xhtml:form[@name='input_form']/xhtml:fieldset/xhtml:table/xhtml:tbody/xhtml:tr/xhtml:td[6]/xhtml:input[@name='inactive']\":false},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319579870-6\",\"lastViewedKey\":\"1294320330644\",\"lastLoadedKey\":\"1294320180686\",\"uriKey\":\"malwaredomainlist.com.www/http//mdl.php?search=FILLMEIN\",\"possibleparent\":\"1294319579535-5\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-malwaredomainlist:\",\"image\":\"http://www.malwaredomainlist.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.mcafee.com/threat-intelligence/ip/default.aspx?ip=FILLMEIN\",\"title\":\"FILLMEIN - IP - McAfee Labs Threat Center\",\"ID\":1535022135,\"formdata\":{\"#q\":\"Search\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319580270-7\",\"lastViewedKey\":\"1294320314609\",\"lastLoadedKey\":\"1294320188763\",\"uriKey\":\"mcafee.com.www/http//threat-intelligence/ip/default.aspx?ip=FILLMEIN\",\"possibleparent\":\"1294319579870-6\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-mcafee:\",\"image\":\"http://www.mcafee.com/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://www.mywot.com/en/scorecard/FILLMEIN\",\"title\":\"FILLMEIN | WOT Reputation Scorecard | WOT (Web of Trust)\",\"ID\":1535022711,\"formdata\":{\"#help_c\":false,\"#conf700\":\"\",\"#edit-url2\":\"example.com\",\"#conf9776\":\"\"},\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319580687-8\",\"lastViewedKey\":\"1294320307215\",\"lastLoadedKey\":\"1294320184087\",\"uriKey\":\"mywot.com.www/http//en/scorecard/FILLMEIN\",\"possibleparent\":\"1294319580270-7\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-mywot:\",\"image\":\"http://cdn-aws.mywot.net/sites/all/images/fusion/16_16/plain/new_trusted.png\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"http://projecthoneypot.org/ip_FILLMEIN\",\"title\":\"FILLMEIN | IP Address Inspector | Project Honey Pot\",\"ID\":20,\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319583950-9\",\"lastViewedKey\":\"1294320305962\",\"lastLoadedKey\":\"1294320188574\",\"uriKey\":\"projecthoneypot.org/http//ip_FILLMEIN\",\"possibleparent\":\"1294319580687-8\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-projecthoneypot:\",\"image\":\"http://www.projecthoneypot.org/favicon.ico\"},\"_formDataSaved\":true},{\"entries\":[{\"url\":\"https://zeustracker.abuse.ch/monitor.php?ipaddress=FILLMEIN\",\"title\":\"ZeuS Tracker :: IP address FILLMEIN\",\"ID\":1535023920,\"scroll\":\"0,0\"}],\"index\":1,\"attributes\":{\"tabid\":\"1294319584274-10\",\"lastViewedKey\":\"1294320297535\",\"lastLoadedKey\":\"1294320302883\",\"uriKey\":\"abuse.ch.zeustracker/https//monitor.php?ipaddress=FILLMEIN\",\"possibleparent\":\"1294319583950-9\",\"outoforder\":\"true\",\"read\":\"true\",\"uriGroup\":\":dG-abuse:\",\"image\":\"https://zeustracker.abuse.ch/favicon.ico\"},\"_formDataSaved\":true}],\"selected\":1,\"_closedTabs\":[],\"extData\":{\"__SessionManagerWindowId\":\"window1294320175306\",\"autoGroupNewTabs\":\"true\",\"activeGrouping\":\"opener\",\"newTabPosition\":\"0\"},\"_hosts\":{\"www.robtex.com\":true,\"senderbase.org\":true,\"blacklistalert.org\":true,\"www.dnsbl.info\":true,\"hosts-file.net\":true,\"www.malwaredomainlist.com\":true,\"www.mcafee.com\":true,\"www.mywot.com\":true,\"projecthoneypot.org\":true},\"width\":1467,\"height\":1097,\"screenX\":351,\"screenY\":92,\"sizemode\":\"normal\",\"cookies\":[{\"host\":\"senderbase.org\",\"value\":\"JCnQXPaIa3JfaAlz0gK0\",\"path\":\"/\",\"name\":\"sid\"},{\"host\":\"blacklistalert.org\",\"value\":\"fd0ed582b28d7a4600171a7580b3f13b\",\"path\":\"/\",\"name\":\"PHPSESSID\"},{\"host\":\"hosts-file.net\",\"value\":\"ALILONDCEOBFIPPMNJLCFMHJ\",\"path\":\"/\",\"name\":\"ASPSESSIONIDCSATQABA\"},{\"host\":\"www.mcafee.com\",\"value\":\"locale=us\",\"path\":\"/\",\"name\":\"CookieInformation\"},{\"host\":\".mcafee.com\",\"value\":\"%5B%5BB%5D%5D\",\"path\":\"/\",\"name\":\"s_sq\"},{\"host\":\".mcafee.com\",\"value\":\"true\",\"path\":\"/\",\"name\":\"s_cc\"},{\"host\":\".mywot.com\",\"value\":\"\",\"path\":\"/\",\"name\":\"partner\",\"expiry\":1294320393520},{\"host\":\".mywot.com\",\"value\":\"false\",\"path\":\"/\",\"name\":\"accessible\",\"expiry\":1294320393520},{\"host\":\".mywot.com\",\"value\":\"3831ec0d55e423db2bb931a6940bb2a15dcbbe25\",\"path\":\"/\",\"name\":\"auth\",\"expiry\":1294320261838},{\"host\":\".mywot.com\",\"value\":\"5ff82d94354b3b6ade558b265e0cef574b93f7bf\",\"path\":\"/\",\"name\":\"nonce\",\"expiry\":1294320261837},{\"host\":\".mywot.com\",\"value\":\"1988b3acf515f0999e81796af551556cde9fc601\",\"path\":\"/\",\"name\":\"id\",\"expiry\":1294320261837},{\"host\":\".mywot.com\",\"value\":\"lfbdgqcbrcpi0ph3dkd1tjo4u5\",\"path\":\"/\",\"name\":\"SESSf6ce7e3db235723091e59a653e7d96f2\"},{\"host\":\".mywot.com\",\"value\":\"1988b3acf515f0999e81796af551556cde9fc601\",\"path\":\"/\",\"name\":\"authid\"},{\"host\":\"projecthoneypot.org\",\"value\":\"u0aipnsbpm95e2gdrgrc7jjel4\",\"path\":\"/\",\"name\":\"vid\"}]}]}\n";
         IPBase = "{\"windows\":[{\"tabs\":[{\"entries\":[{\"url\":\"about:home\",\"title\":\"Mozilla Firefox Start Page\",\"ID\":0,\"docshellID\":5,\"docIdentifier\":0},{\"url\":\"http://ip.robtex.com/FILMEIN.html\",\"title\":\"FILMEIN - robtex\",\"ID\":3,\"docshellID\":5,\"docIdentifier\":3,\"children\":[{\"url\":\"http://platform.twitter.com/widgets/tweet_button.1358286701.html#_=1358366031042&count=horizontal&counturl=http%3A%2F%2Fip.robtex.com%2FFILMEIN.html&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fip.robtex.com%2FFILMEIN.html&size=m&text=FILMEIN%20-%20robtex&url=http%3A%2F%2Fip.robtex.com%2FFILMEIN.html\",\"title\":\"Tweet Button\",\"ID\":4,\"docshellID\":8,\"referrer\":\"http://ip.robtex.com/FILMEIN.html\",\"docIdentifier\":4,\"scroll\":\"0,0\"},{\"url\":\"https://plusone.google.com/_/+1/fastbutton?bsv&size=small&hl=en-US&origin=http%3A%2F%2Fip.robtex.com&url=http%3A%2F%2Fip.robtex.com%2FFILMEIN.html&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.KRUgNZWFWYA.O%2Fm%3D__features__%2Fam%3DiQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTN1UhlUV153J6ulGPt8k3sksl4Ctw#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled&id=I0_1358366031219&parent=http%3A%2F%2Fip.robtex.com\",\"ID\":5,\"docshellID\":9,\"referrer\":\"http://ip.robtex.com/FILMEIN.html\",\"docIdentifier\":5,\"scroll\":\"0,0\"},{\"url\":\"https://plusone.google.com/u/0/_/pages/badge?bsv&hl=en-US&origin=http%3A%2F%2Fip.robtex.com&url=https%3A%2F%2Fplus.google.com%2F116897974572652135787&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.KRUgNZWFWYA.O%2Fm%3D__features__%2Fam%3DiQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTN1UhlUV153J6ulGPt8k3sksl4Ctw#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Conauth&id=I1_1358366031266&parent=http%3A%2F%2Fip.robtex.com\",\"ID\":6,\"docshellID\":10,\"referrer\":\"http://ip.robtex.com/FILMEIN.html\",\"docIdentifier\":6,\"scroll\":\"0,0\"}],\"scroll\":\"0,0\"}],\"index\":2,\"hidden\":false,\"attributes\":{\"image\":\"\"}},{\"entries\":[{\"url\":\"http://whois.domaintools.com/FILMEIN\",\"title\":\"FILMEIN IP Address WHOIS | DomainTools.com\",\"ID\":7,\"docshellID\":6,\"docIdentifier\":7,\"formdata\":{\"id\":{\"dt-search-input-search-type\":{\"selectedIndex\":0,\"value\":\"http://www.domaintools.com/go/?service=whois&q=\"}},\"xpath\":{}},\"scroll\":\"0,0\"}],\"index\":1,\"hidden\":false,\"attributes\":{\"image\":\"http://whois.domaintools.com/favicon.png\"}},{\"entries\":[{\"url\":\"http://www.bfk.de/bfk_dnslogger.html?query=FILMEIN#result\",\"title\":\"BFK edv-consulting GmbH - Sicherheit\",\"ID\":8,\"docshellID\":7,\"docIdentifier\":8,\"scroll\":\"0,490\"}],\"index\":1,\"hidden\":false,\"attributes\":{\"image\":\"http://www.bfk.de/favicon.ico\"}}],\"selected\":3,\"_closedTabs\":[],\"busy\":false,\"extData\":{\"__SessionManagerWindowId\":\"window1358365905258\"},\"width\":1283,\"height\":960,\"screenX\":251,\"screenY\":0,\"sizemode\":\"normal\",\"cookies\":[{\"host\":\".robtex.com\",\"value\":\"27925695\",\"path\":\"/\",\"name\":\"__utmc\"},{\"host\":\".domaintools.com\",\"value\":\"5d0900e3d868de1f2d20886488937dc4\",\"path\":\"/\",\"name\":\"csrftoken\"},{\"host\":\".whois.domaintools.com\",\"value\":\"225854556\",\"path\":\"/\",\"name\":\"__utmc\"}]}],\"selectedWindow\":1,\"_closedWindows\":[],\"session\":{\"state\":\"running\",\"lastUpdate\":1358366054833,\"startTime\":1358365902656,\"recentCrashes\":0},\"scratchpads\":[]}\n";
		}
		
		if(blockListFileExists){
			blockList = loadFile(blockListFile);
			blocked = blockList;
		}else{
			blockList = "nothing";
		}
		
	}
	
	
	
	public String GetBlockList(){
		return blockList;
	}
		
	
	public String IPBase(){
		return IPBase;
	}
	
	public String UrlBase(){
		return urlBase;
	}
	
	/**
	 * read file and create string from it. Because windows inserts a BOM when creating UTF-8 files I skip the first three bytes to prevent adding it to string. 
	 */
	private String loadFile(String myFile){
		String base = "";
		try {
			FileInputStream fstream = new FileInputStream(myFile);
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(
					new InputStreamReader(in, "UTF-8"));
			String strLine; 
			br.skip(1); //God I hate cross platform BS
			while ((strLine = br.readLine()) != null) {
				
				base = base.concat(strLine);
				
			}

		} catch (Exception e) {
			System.err.println("Error: " + e.getMessage());
		}   
		return base;
	}
}

